﻿using System;

namespace BoilerEvent_tz
{
    class DelegateTest
    {
        public delegate void delegate_tz(); // ## MY IDEA ##：static 对delegate修饰无效，必须new

        public event delegate_tz delegate_tz0;

        public void Start()
        {
            Console.WriteLine("启动事件");
            delegate_tz0(); // 得调用该事件
            Console.ReadKey();
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            DelegateTest DelegateTest0 = new DelegateTest();
            //DelegateTest0.delegate_tz0 += DelegateTest.delegate_tz(Test); // 必须new一下才行，因为它是另外一个类呀
            DelegateTest0.delegate_tz0 += new DelegateTest.delegate_tz(Test);
            DelegateTest0.Start(); //启动事件
        }

        public static void Test()
        {
            Console.WriteLine("这是一个被注册得函数，按任意键继续...");
            Console.ReadKey();
        }
    }
}